<!DOCTYPE html>
<html lang="en">

<head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
      <style>
            .bg{
                  background-color: aquamarine;
                  width: 100%;
                  height: 500px;
            }
      </style>
</head>
<body> 
      <div class="bg">
            <wx-open-launch-weapp id="launch-btn" class="launch-weapp" username="gh_4517cd2fc20c" path="/pages/guide/main.html">
                  <script type="text/wxtag-template">
                        <style>.btn { padding: 12px }</style>
                        <button class="btn">打开小程序1</button>
                  </script>
            </wx-open-launch-weapp>
      </div>
      <script src="https://cdn.bootcdn.net/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
      <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
      <script src="http://wechatfe.github.io/vconsole/lib/vconsole.min.js?v=3.2.0"></script>
      <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
      <script type="text/javascript">
            // var socket = io('http://localhost:8360');
            // socket.on('connect', function (err, res) {
            //       // socket.join('some room');
                  
            //       // socket.emit('join', {
            //       //       roomId: new URLSearchParams(location.search).get('id'),
            //       //       id: socket.id
            //       // })

            //       socket.on('join', function (data) {
            //             console.log('opend:', data, new URLSearchParams(location.search).get('id'));
            //       });

            //       // socket.on('joined', function (data) {
            //       //       console.log('joined:', data);
            //       // });
            // })


            // $('.send').on('click', function (evt) {
            //       var username = $.trim(1111);
            //       if (username) {
            //             socket.emit('addUser', {
            //                   name: username,
            //                   id: socket.id
            //             });
            //       }
            // });
            new VConsole();
            const get =  async function(){
                  const response = await fetch('https://oauth.51jja.cn/home/wechat/Oauth/I0cSDxhuWGPBaHXs/jssdk',{
                        method:"post",
                        headers: {
                              "Content-type": "application/x-www-form-urlencoded; charset=UTF-8",
                        },
                        body:`url=${location.href.split('#')[0]}`
                  })
                  const {data} = await response.json();
                  wx.config({
                        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                        appId: data.appid, // 必填，公众号的唯一标识
                        timestamp: data.timestamp, // 必填，生成签名的时间戳
                        nonceStr: data.noncestr, // 必填，生成签名的随机串
                        signature: data.signature,// 必填，签名
                        jsApiList: ['checkJsApi'], // 必填，需要使用的JS接口列表
                        openTagList: ['wx-open-launch-app','wx-open-launch-weapp']
                  });
                  wx.ready(function(){})
                  wx.error(function(){})
            }
      </script>
</body>

</html>